# -*- coding: utf-8 -*-
from datetime import timedelta
from jms.dws.dws_customer_ticket_quantity_dt import jms_dws__dws_customer_ticket_quantity_dt
from utils.operators.cluster_for_spark_sql_operator import SparkSqlOperator

jms_dm__dm_customer_date_network_level_ticket_detail_dt = SparkSqlOperator(
    task_id='jms_dm__dm_customer_date_network_level_ticket_detail_dt',
    email=['shenjiaming@jtexpress.com','yl_bigdata@yl-scm.com'],
    pool_slots=5,
    master='yarn',
    name='jms_dm__dm_customer_date_network_level_ticket_detail_dt_{{ execution_date | cst_ds_nodash }}',
    sql='jms/dm/dm_customer_date_network_level_ticket_detail_dt/execute.hql',
    driver_memory='4G' , 
    executor_memory='4G' , 
    executor_cores=3 , 
    num_executors=5 , 
    yarn_queue='pro',
    conf={'spark.dynamicAllocation.enabled': 'true',  # 动态资源开启
          'spark.shuffle.service.enabled': 'true',  # 动态资源 Shuffle 服务开启
        'spark.dynamicAllocation.maxExecutors'             : 6 , 
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 60,  # 动态资源自动释放闲置 Executor 的超时时间(s)
          'spark.sql.sources.partitionOverwriteMode': 'dynamic',  # 允许删改已存在的分区
        'spark.executor.memoryOverhead'             : '2G' , 
          },
    execution_timeout=timedelta(minutes=60),
)

jms_dm__dm_customer_date_network_level_ticket_detail_dt << jms_dws__dws_customer_ticket_quantity_dt
